package com.wcx.behavior.observer;

/**
 * 项目: design-pattern-githupdemo
 * <p>
 * 功能描述:
 *
 * @author: WuChengXing
 * @create: 2021-01-11 22:25
 **/
public class Observer2 implements Observer {

    private Subject subject;

    /**
     * 通过构造函数进行注册
     *
     * @param subject
     */
    public Observer2(Subject subject) {
        this.subject = subject;
        subject.registerObserver(this);
    }

    @Override
    public void update(String msg) {
        System.out.println("observer2 得到 3D 号码 -->" + msg + "我要告诉舍友们。");
    }
}
